public class code1 {
    public static void main(String[] args) {
        String str = "racecar";
        System.out.println(Palindrome(str));
        String str2 = "hello";
        System.out.println(Palindrome(str2));
        String str3 = "madam";
        System.out.println(Palindrome(str3));
    }

    public static boolean Palindrome(String str) {
        if(str.length() <= 1) {
            return true;
        }
        if(str.charAt(0) != str.charAt(str.length()-1)) {
            return false;
        }

        return Palindrome(str.substring(1,str.length()-1));
    }
}
